// models/bookModel.js

class BookModel {
    constructor(db) {
        this.db = db;
    }

    async createBook(name, des, type) {
        return new Promise((resolve, reject) => {
            this.db.query('INSERT INTO books (name, des, type) VALUES (?, ?, ?)', 
                          [name, des, type], 
                          (err, results) => {
                if (err) return reject(err);
                resolve(results.insertId);
            });
        });
    }


}

module.exports = BookModel;